<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@ include file="../include/laypublic.jsp" %>
<!DOCTYPE html>
<html>
<head>
</head>
<title>营销立项</title>
<style type="text/css">
    .layui-form-select dl {
        max-height: 150px;
    / / 原值为300，调节高度建议为50的倍数
    }

    .layui-form-label {
        width: 60px;
    }

    .flex {
        display: flex;
        justify-content: flex-start;
        align-items: center;
        margin-left: 50px !important;
        line-height: 1;
    }

    .flex span {
        line-height: 1;
        margin-right: 10px;
    }
</style>
</head>
<body>
<div class="layui-tab layui-tab-brief" lay-filter="yxlx-tab-all">
    <ul class="layui-tab-title">
        <li id="yxlxId" class="layui-this" lay-id="0">营销立项</li>
        <li id="xmxxsjId" lay-id="1">项目信息收集</li>
        <li id="ylxId" lay-id="2">预立项</li>
        <li id="lxId" lay-id="3">立项</li>
        <li id="yxchId" lay-id="4">营销策划</li>
        <li id="fxzlId" lay-id="5">风险总览</li>
    </ul>
    <div class="layui-tab-content" style="height: 100px;">
        <!-- 营销立项 -->
        <!-- ************************************************* 营销立项 *********************************************************** -->
        <div class="layui-tab-item layui-show">
            <!-- 查询区域  -->
            <div id="yxlx-query-form" class="layui-form layui-card-header layuiadmin-card-header-auto">
                <div class="layui-form-item">
                    <div class="layui-inline">
                        <label class="layui-form-label">项目名称</label>
                        <div class="layui-input-inline">
                            <input type="text" name="proName" placeholder="请输入项目名称" autocomplete="off"
                                   class="layui-input">
                        </div>
                    </div>
                    <div class="layui-inline">
                        <label class="layui-form-label">区域公司</label>
                        <div class="layui-input-inline">
                            <select name="hrOrgId">
                                <option value="">全部</option>
                                <c:if test="${not empty orgInfoList }">
                                    <c:forEach items="${orgInfoList}" var="orgInfo">
                                        <option value="${orgInfo.id}">${orgInfo.compName }</option>
                                    </c:forEach>
                                </c:if>
                            </select>
                        </div>
                    </div>
                    <div class="layui-inline">
                        <label class="layui-form-label">日期</label>
                        <div class="layui-input-inline">
                            <input type="text" class="layui-input" id="yxlx-laydate-date" name="date" readonly
                                   placeholder="日期">
                        </div>
                    </div>
                    <div class="layui-inline">
                        <label class="layui-form-label">状态</label>
                        <div class="layui-input-inline">
                            <select name="proStage">
                                <option value="">全部</option>
                                <option value="1">预立项</option>
                                <option value="2">立项</option>
                                <option value="3">营销策划</option>
                            </select>
                        </div>
                    </div>
                    <div class="layui-inline">
                        <button class="layui-btn layuiadmin-btn-admin" lay-submit lay-filter="lay-yxlx-search">
                            <i class="layui-icon layui-icon-search layuiadmin-button-btn"></i>查询
                        </button>
                        <button class="layui-btn layuiadmin-btn-admin" lay-submit lay-filter="lay-yxlx-back-reset">
                            <i class="layui-icon layui-icon-fonts-clear  layuiadmin-button-btn"></i>重置
                        </button>
                    </div>
                </div>
            </div>
            <!-- 数据表单 -->
            <div class="layui-tab-item layui-show">
                <div class="layui-form-item "
                     style="width: 100% ;background: white;display: flex;margin: 0;padding: 6px 0">
                    <div class="layui-inline flex"><span
                            style="font-size: 35px;color: rgb(22,168,225);margin-top: -5px">○</span>表示：可执行
                    </div>
                    <div class="layui-inline flex"><span style="font-size: 25px;color: rgb(59,177,156)">✓</span>表示：评审通过
                    </div>
                    <div class="layui-inline flex"><span style="font-size: 25px;color: rgb(225,6,6)">ㄨ</span>表示：评审不通过
                    </div>
                    <div class="layui-inline flex"><span style="font-size: 25px;color: rgb(225,93,36)">ニ</span>表示：评审中
                    </div>
                    <div class="layui-inline flex"><span style="font-size: 25px;color: rgb(80,90,110)">／</span>表示：不需要评审
                    </div>
                </div>
                <table id="lay-yxlx-create-manage" lay-filter="lay-yxlx-create-manage" style="margin-top: 0"></table>
            </div>
        </div>

        <!-- 项目信息收集 -->
        <!-- ************************************************* 项目信息收集 *********************************************************** -->
        <div class="layui-tab-item">
            <!-- 查询区域  -->
            <div id="xmxxsj-query-form" class="layui-form layui-card-header layuiadmin-card-header-auto">
                <div class="layui-form-item">
                    <div class="layui-inline">
                        <label class="layui-form-label">项目编码</label>
                        <div class="layui-input-inline">
                            <input type="text" name="proCode" placeholder="请输入项目编码" autocomplete="off"
                                   class="layui-input">
                        </div>
                    </div>
                    <div class="layui-inline">
                        <label class="layui-form-label">项目名称</label>
                        <div class="layui-input-inline">
                            <input type="text" name="proName" placeholder="请输入项目名称" autocomplete="off"
                                   class="layui-input">
                        </div>
                    </div>
                    <div class="layui-inline">
                        <label class="layui-form-label">区域公司</label>
                        <div class="layui-input-inline">
                            <select name="hrOrgId">
                                <option value="">全部</option>
                                <c:if test="${not empty orgInfoList }">
                                    <c:forEach items="${orgInfoList}" var="orgInfo">
                                        <option value="${orgInfo.id}">${orgInfo.compName }</option>
                                    </c:forEach>
                                </c:if>
                            </select>
                        </div>
                    </div>
                    <div class="layui-inline">
                        <label class="layui-form-label">状态</label>
                        <div class="layui-input-inline">
                            <select name="processStatus">
                                <option value="">全部</option>
                                <option value="1">审批中</option>
                                <option value="9">审批完成</option>
                                <option value="10">审批终止</option>
                            </select>
                        </div>
                    </div>
                    <div class="layui-inline">
                        <label class="layui-form-label">日期</label>
                        <div class="layui-input-inline">
                            <input type="text" class="layui-input" id="xmxxsj-laydate-dates" name="dates" readonly
                                   placeholder="请选择创建时间">
                        </div>
                    </div>
                    <div class="layui-inline">
                        <label class="layui-form-label">营销经理</label>
                        <div class="layui-input-inline">
                            <select name="staffId">
                                <option value="">全部</option>
                                <c:if test="${not empty staffInfoList }">
                                    <c:forEach items="${staffInfoList}" var="staffInfo">
                                        <option value="${staffInfo.id}">${staffInfo.staffName }</option>
                                    </c:forEach>
                                </c:if>
                            </select>
                        </div>
                    </div>
                    <div class="layui-inline">
                        <label class="layui-form-label">投资金额</label>
                        <div class="layui-input-inline" style="width:100px">
                            <input type="text" name="sumAmountMin" autocomplete="off" class="layui-input">
                        </div>
                        <div class="layui-form-mid">-</div>
                        <div class="layui-input-inline" style="width:100px">
                            <input type="text" name="sumAmountMax" autocomplete="off" class="layui-input">
                        </div>
                    </div>
                    <div class="layui-inline">
                        <button class="layui-btn layuiadmin-btn-admin" lay-submit lay-filter="lay-xmxxsj-search">
                            <i class="layui-icon layui-icon-search layuiadmin-button-btn"></i>查询
                        </button>
                        <button class="layui-btn layuiadmin-btn-admin" lay-submit lay-filter="lay-xmxxsj-back-reset">
                            <i class="layui-icon layui-icon-fonts-clear  layuiadmin-button-btn"></i>重置
                        </button>
                        <button class="layui-btn layuiadmin-btn-admin" lay-submit lay-filter="lay-xmxxsj-new">
                            <i class="layui-icon layui-icon-add-1  layuiadmin-button-btn"></i>新建
                        </button>
                    </div>
                </div>
            </div>
            <!-- 数据表单 -->
            <div class="layui-tab-item layui-show">
                <table id="lay-xmxxsj-create-manage" lay-filter="lay-xmxxsj-create-manage"></table>
            </div>
        </div>

        <!-- 预立项 -->
        <!-- ************************************************* 预立项 *********************************************************** -->
        <div class="layui-tab-item">
            <!-- 查询区域  -->
            <div id="ylx-query-form" class="layui-form layui-card-header layuiadmin-card-header-auto">
                <div class="layui-form-item">
                    <div class="layui-inline">
                        <label class="layui-form-label">项目编码</label>
                        <div class="layui-input-inline">
                            <input type="text" name="proCode" placeholder="请输入项目编码" autocomplete="off"
                                   class="layui-input">
                        </div>
                    </div>
                    <div class="layui-inline">
                        <label class="layui-form-label">项目名称</label>
                        <div class="layui-input-inline">
                            <input type="text" name="proName" placeholder="请输入项目名称" autocomplete="off"
                                   class="layui-input">
                        </div>
                    </div>
                    <div class="layui-inline">
                        <label class="layui-form-label">区域公司</label>
                        <div class="layui-input-inline">
                            <select name="hrOrgId">
                                <option value="">全部</option>
                                <c:if test="${not empty orgInfoList }">
                                    <c:forEach items="${orgInfoList}" var="orgInfo">
                                        <option value="${orgInfo.id}">${orgInfo.compName }</option>
                                    </c:forEach>
                                </c:if>
                            </select>
                        </div>
                    </div>
                    <div class="layui-inline">
                        <label class="layui-form-label">状态</label>
                        <div class="layui-input-inline">
                            <select name="processStatus">
                                <option value="">全部</option>
                                <option value="1">审批中</option>
                                <option value="9">审批完成</option>
                                <option value="10">审批终止</option>
                            </select>
                        </div>
                    </div>
                    <div class="layui-inline">
                        <label class="layui-form-label">日期</label>
                        <div class="layui-input-inline">
                            <input type="text" class="layui-input" id="ylx-laydate-dates" name="dates" readonly
                                   placeholder="请选择创建时间">
                        </div>
                    </div>
                    <div class="layui-inline">
                        <label class="layui-form-label">营销经理</label>
                        <div class="layui-input-inline">
                            <select name="staffId">
                                <option value="">全部</option>
                                <c:if test="${not empty staffInfoList }">
                                    <c:forEach items="${staffInfoList}" var="staffInfo">
                                        <option value="${staffInfo.id}">${staffInfo.staffName }</option>
                                    </c:forEach>
                                </c:if>
                            </select>
                        </div>
                    </div>
                    <div class="layui-inline">
                        <label class="layui-form-label">投资金额</label>
                        <div class="layui-input-inline" style="width:100px">
                            <input type="text" name="sumAmountMin" autocomplete="off" class="layui-input">
                        </div>
                        <div class="layui-form-mid">-</div>
                        <div class="layui-input-inline" style="width:100px">
                            <input type="text" name="sumAmountMax" autocomplete="off" class="layui-input">
                        </div>
                    </div>
                    <div class="layui-inline">
                        <button class="layui-btn layuiadmin-btn-admin" lay-submit lay-filter="lay-ylx-search">
                            <i class="layui-icon layui-icon-search layuiadmin-button-btn"></i>查询
                        </button>
                        <button class="layui-btn layuiadmin-btn-admin" lay-submit lay-filter="lay-ylx-back-reset">
                            <i class="layui-icon layui-icon-fonts-clear  layuiadmin-button-btn"></i>重置
                        </button>
                    </div>
                </div>
            </div>
            <!-- 数据表单 -->
            <div class="layui-tab-item layui-show">
                <table id="lay-ylx-create-manage" lay-filter="lay-ylx-create-manage"></table>
            </div>
        </div>

        <!-- 立项 -->
        <!-- ************************************************* 立项 *********************************************************** -->
        <div class="layui-tab-item">
            <!-- 查询区域  -->
            <div id="lx-query-form" class="layui-form layui-card-header layuiadmin-card-header-auto">
                <div class="layui-form-item">
                    <div class="layui-inline">
                        <label class="layui-form-label">项目编码</label>
                        <div class="layui-input-inline">
                            <input type="text" name="proCode" placeholder="请输入项目编码" autocomplete="off"
                                   class="layui-input">
                        </div>
                    </div>
                    <div class="layui-inline">
                        <label class="layui-form-label">项目名称</label>
                        <div class="layui-input-inline">
                            <input type="text" name="proName" placeholder="请输入项目名称" autocomplete="off"
                                   class="layui-input">
                        </div>
                    </div>
                    <div class="layui-inline">
                        <label class="layui-form-label">区域公司</label>
                        <div class="layui-input-inline">
                            <select name="hrOrgId">
                                <option value="">全部</option>
                                <c:if test="${not empty orgInfoList }">
                                    <c:forEach items="${orgInfoList}" var="orgInfo">
                                        <option value="${orgInfo.id}">${orgInfo.compName }</option>
                                    </c:forEach>
                                </c:if>
                            </select>
                        </div>
                    </div>
                    <div class="layui-inline">
                        <label class="layui-form-label">状态</label>
                        <div class="layui-input-inline">
                            <select name="processStatus">
                                <option value="">全部</option>
                                <option value="1">审批中</option>
                                <option value="9">审批完成</option>
                                <option value="10">审批终止</option>
                            </select>
                        </div>
                    </div>
                    <div class="layui-inline">
                        <label class="layui-form-label">日期</label>
                        <div class="layui-input-inline">
                            <input type="text" class="layui-input" id="lx-laydate-dates" name="dates" readonly
                                   placeholder="请选择创建时间">
                        </div>
                    </div>
                    <div class="layui-inline">
                        <label class="layui-form-label">营销经理</label>
                        <div class="layui-input-inline">
                            <select name="staffId">
                                <option value="">全部</option>
                                <c:if test="${not empty staffInfoList }">
                                    <c:forEach items="${staffInfoList}" var="staffInfo">
                                        <option value="${staffInfo.id}">${staffInfo.staffName }</option>
                                    </c:forEach>
                                </c:if>
                            </select>
                        </div>
                    </div>
                    <div class="layui-inline">
                        <label class="layui-form-label">投资金额</label>
                        <div class="layui-input-inline" style="width:100px">
                            <input type="text" name="sumAmountMin" autocomplete="off" class="layui-input">
                        </div>
                        <div class="layui-form-mid">-</div>
                        <div class="layui-input-inline" style="width:100px">
                            <input type="text" name="sumAmountMax" autocomplete="off" class="layui-input">
                        </div>
                    </div>
                    <div class="layui-inline">
                        <button class="layui-btn layuiadmin-btn-admin" lay-submit lay-filter="lay-lx-search">
                            <i class="layui-icon layui-icon-search layuiadmin-button-btn"></i>查询
                        </button>
                        <button class="layui-btn layuiadmin-btn-admin" lay-submit lay-filter="lay-lx-back-reset">
                            <i class="layui-icon layui-icon-fonts-clear  layuiadmin-button-btn"></i>重置
                        </button>
                    </div>
                </div>
            </div>
            <!-- 数据表单 -->
            <div class="layui-tab-item layui-show">
                <table id="lay-lx-create-manage" lay-filter="lay-lx-create-manage"></table>
            </div>
        </div>

        <!-- 营销策划 -->
        <!-- ************************************************* 营销策划 *********************************************************** -->
        <div class="layui-tab-item">
            <!-- 查询区域  -->
            <div id="yxch-query-form" class="layui-form layui-card-header layuiadmin-card-header-auto">
                <div class="layui-form-item">
                    <div class="layui-inline">
                        <label class="layui-form-label">项目编码</label>
                        <div class="layui-input-inline">
                            <input type="text" name="proCode" placeholder="请输入项目编码" autocomplete="off"
                                   class="layui-input">
                        </div>
                    </div>
                    <div class="layui-inline">
                        <label class="layui-form-label">项目名称</label>
                        <div class="layui-input-inline">
                            <input type="text" name="proName" placeholder="请输入项目名称" autocomplete="off"
                                   class="layui-input">
                        </div>
                    </div>
                    <div class="layui-inline">
                        <label class="layui-form-label">区域公司</label>
                        <div class="layui-input-inline">
                            <select name="hrOrgId">
                                <option value="">全部</option>
                                <c:if test="${not empty orgInfoList }">
                                    <c:forEach items="${orgInfoList}" var="orgInfo">
                                        <option value="${orgInfo.id}">${orgInfo.compName }</option>
                                    </c:forEach>
                                </c:if>
                            </select>
                        </div>
                    </div>
                    <div class="layui-inline">
                        <label class="layui-form-label">状态</label>
                        <div class="layui-input-inline">
                            <select name="processStatus">
                                <option value="">全部</option>
                                <option value="1">审批中</option>
                                <option value="9">审批完成</option>
                                <option value="10">审批终止</option>
                            </select>
                        </div>
                    </div>
                    <div class="layui-inline">
                        <label class="layui-form-label">日期</label>
                        <div class="layui-input-inline">
                            <input type="text" class="layui-input" id="yxch-laydate-dates" name="dates" readonly
                                   placeholder="请选择创建时间">
                        </div>
                    </div>
                    <div class="layui-inline">
                        <label class="layui-form-label">营销经理</label>
                        <div class="layui-input-inline">
                            <select name="staffId">
                                <option value="">全部</option>
                                <c:if test="${not empty staffInfoList }">
                                    <c:forEach items="${staffInfoList}" var="staffInfo">
                                        <option value="${staffInfo.id}">${staffInfo.staffName }</option>
                                    </c:forEach>
                                </c:if>
                            </select>
                        </div>
                    </div>
                    <div class="layui-inline">
                        <label class="layui-form-label">营销金额</label>
                        <div class="layui-input-inline" style="width:100px">
                            <input type="text" name="sumAmountMin" autocomplete="off" class="layui-input">
                        </div>
                        <div class="layui-form-mid">-</div>
                        <div class="layui-input-inline" style="width:100px">
                            <input type="text" name="sumAmountMax" autocomplete="off" class="layui-input">
                        </div>
                    </div>
                    <div class="layui-inline">
                        <button class="layui-btn layuiadmin-btn-admin" lay-submit lay-filter="lay-yxch-search">
                            <i class="layui-icon layui-icon-search layuiadmin-button-btn"></i>查询
                        </button>
                        <button class="layui-btn layuiadmin-btn-admin" lay-submit lay-filter="lay-yxch-back-reset">
                            <i class="layui-icon layui-icon-fonts-clear  layuiadmin-button-btn"></i>重置
                        </button>
                    </div>
                </div>
            </div>
            <!-- 数据表单 -->
            <div class="layui-tab-item layui-show">
                <table id="lay-yxch-create-manage" lay-filter="lay-yxch-create-manage"></table>
            </div>
        </div>

        <!-- 风险总览 -->
        <!-- ************************************************* 风险总览 *********************************************************** -->
        <div class="layui-tab-item">
            <!-- 查询区域  -->
            <div id="fxzl-query-form" class="layui-form layui-card-header layuiadmin-card-header-auto">
                <div class="layui-form-item">
                    <div class="layui-inline">
                        <label class="layui-form-label">项目名称</label>
                        <div class="layui-input-inline">
                            <input type="text" name="proName" placeholder="请输入项目名称" autocomplete="off"
                                   class="layui-input">
                        </div>
                    </div>
                    <div class="layui-inline">
                        <label class="layui-form-label">区域公司</label>
                        <div class="layui-input-inline">
                            <select name="hrOrgId">
                                <option value="">全部</option>
                                <c:if test="${not empty orgInfoList }">
                                    <c:forEach items="${orgInfoList}" var="orgInfo">
                                        <option value="${orgInfo.id}">${orgInfo.compName }</option>
                                    </c:forEach>
                                </c:if>
                            </select>
                        </div>
                    </div>
                    <div class="layui-inline">
                        <label class="layui-form-label">状态</label>
                        <div class="layui-input-inline">
                            <select name="status">
                                <option value="">全部</option>
                                <option value="0">跟踪中</option>
                                <option value="1">已中标</option>
                                <option value="2">已失标</option>
                            </select>
                        </div>
                    </div>
                    <div class="layui-inline">
                        <button class="layui-btn layuiadmin-btn-admin" lay-submit lay-filter="lay-fxzl-search">
                            <i class="layui-icon layui-icon-search layuiadmin-button-btn"></i>查询
                        </button>
                        <button class="layui-btn layuiadmin-btn-admin" lay-submit lay-filter="lay-fxzl-back-reset">
                            <i class="layui-icon layui-icon-fonts-clear  layuiadmin-button-btn"></i>重置
                        </button>
                    </div>
                </div>
            </div>
            <!-- 数据表单 -->
            <div class="layui-tab-item layui-show">
                <table id="lay-fxzl-create-manage" lay-filter="lay-fxzl-create-manage"></table>
            </div>
        </div>
    </div>
</div>

<script>
    layui.config({
        base: '${ctx}/resources/layuiadmin/' //静态资源所在路径
    }).extend({
        index: 'lib/index' //主入口模块
    }).use(['index', 'table', 'set', 'transfer', 'laydate', 'element', 'layer'], function () {
        var $ = layui.$
            , form = layui.form
            , table = layui.table
            , element = layui.element
            , laydate = layui.laydate
            , layer = layui.layer;

        loadYxlx();

        //选项卡切换监听
        element.on('tab(yxlx-tab-all)', function (data) {
            var layId = $(this).attr('lay-id');
            if (layId === "0") {
                loadYxlx();
            } else if (layId === "1") {
                loadXmxxsj();
            } else if (layId === "2") {
                loadYlx();
            } else if (layId === "3") {
                loadLx();
            } else if (layId === "4") {
                loadYxch();
            } else if (layId === "5") {
                loadFxzl();
            }
        });

        //营销立项页面
        /**************************************** 营销立项页面 **************************************************************/
        function loadYxlx() {
            //日期
            laydate.render({
                elem: '#yxlx-laydate-date'
            });

            // 表单
            table.render({
                elem: '#lay-yxlx-create-manage'
                , url: basePath + '/marketManage/queryDataByCondition' //请求数据接口
                , cols: [[
                    {field: 'orgAreaName', title: '区域公司', align: 'center'}
                    , {field: 'proName', title: '项目名称', align: 'center'}
                    , {
                        field: 'collectType', title: '项目信息收集', align: 'center', event: '0', templet: function (d) {
                            var optStr = "";
                            //1=审批中 9=审批完成 10=审批终止
                            if (d.collectType == 1) {
                                optStr += '<span style="font-size: 25px;color: rgb(225,93,36)">ニ</span>';
                            } else if (d.collectType == 9) {
                                optStr += '<span style="font-size: 25px;color: rgb(59,177,156)">✓</span>';
                            } else if (d.collectType == 10) {
                                optStr += '<span style="font-size: 25px;color: rgb(225,6,6)">ㄨ</span>';
                            }
                            return optStr;
                        }
                    }
                    , {
                        field: 'prepareProType', title: '预立项', align: 'center', event: '1', templet: function (d) {
                            var optStr = "";
                            //1=审批中 9=审批完成 10=审批终止
                            if (d.prepareProType == 1) {
                                optStr += '<span style="font-size: 25px;color: rgb(225,93,36)">ニ</span>';
                            } else if (d.prepareProType == 9) {
                                optStr += '<span style="font-size: 25px;color: rgb(59,177,156)">✓</span>';
                            } else if (d.prepareProType == 10) {
                                optStr += '<span style="font-size: 25px;color: rgb(225,6,6)">ㄨ</span>';
                            }else if (d.prepareProId) {
                                optStr += ' <span style="font-size: 35px;color: rgb(22,168,225);margin-top: -5px">○</span>';
                            }
                            return optStr;
                        }
                    }
                    , {
                        field: 'projectType', title: '立项', align: 'center', event: '2', templet: function (d) {
                            var optStr = "";
                            //1=审批中 9=审批完成 10=审批终止
                            if (d.projectType == 1) {
                                optStr += '<span style="font-size: 25px;color: rgb(225,93,36)">ニ</span>';
                            } else if (d.projectType == 9) {
                                optStr += '<span style="font-size: 25px;color: rgb(59,177,156)">✓</span>';
                            } else if (d.projectType == 10) {
                                optStr += '<span style="font-size: 25px;color: rgb(225,6,6)">ㄨ</span>';
                            }else if (d.projectId) {
                                optStr += ' <span style="font-size: 35px;color: rgb(22,168,225);margin-top: -5px">○</span>';
                            }
                            return optStr;
                        }
                    }
                    , {
                        field: 'marketingType', title: '营销策划', align: 'center', event: '3', templet: function (d) {
                            var optStr = "";
                            //1=审批中 9=审批完成 10=审批终止
                            if (d.marketingType == 1) {
                                optStr += '<span style="font-size: 25px;color: rgb(225,93,36)">ニ</span>';
                            } else if (d.marketingType == 9) {
                                optStr += '<span style="font-size: 25px;color: rgb(59,177,156)">✓</span>';
                            } else if (d.marketingType == 10) {
                                optStr += '<span style="font-size: 25px;color: rgb(225,6,6)">ㄨ</span>';
                            }else if (d.marketingId) {
                                optStr += ' <span style="font-size: 35px;color: rgb(22,168,225);margin-top: -5px">○</span>';
                            }
                            return optStr;
                        }
                    }
                    , {
                        title: '操作', fixed: 'right', templet: function (d) {
                            var optStr = "";
                            optStr += '<a class="layui-btn layui-btn-xs" lay-event="view"><i class="layui-icon layui-icon-form"></i>项目跟踪</a>';
                            return optStr;
                        }
                    }
                ]]
                , page: true
                , limit: 10
            });

            //监听搜索
            form.on('submit(lay-yxlx-search)', function (data) {
                table.reload('lay-yxlx-create-manage', {
                    page: {curr: 1},
                    where: trimData(data)
                });
            });
            //重置清空
            form.on('submit(lay-yxlx-back-reset)', function (data) {
                reset_form('yxlx-query-form');
                //额外处理select
                $("#query-form-state").val('');
                form.render();
            });

            // 监听操作列
            table.on('tool(lay-yxlx-create-manage)', function (obj) {
                var data = obj.data;
                if (obj.event === 'view') {//查看详情
                    parent.layui.index.openTabsPage(basePath + '/proTrack/toDealOrDetail?proCode=' + data.proCode, '项目跟踪 > 详情');
                } else if (obj.event === 'copy') {//复制单据
                    parent.layui.index.openTabsPage(basePath + '/collectProject/toCopy?id=' + data.id, '项目信息收集 > 复制单据');
                } else if (obj.event === 'del') {
                    layer.confirm('确定要删除？', {icon: 3, title: '提示'}, function (index) {
                        $.ajax({
                            type: 'post',
                            url: basePath + '/flowProcess/logicDel',
                            data: {
                                "processId": data.processId
                            },//数据，这里使用的是Json格式进行传输
                            success: function (result) {
                                if (result) {
                                    table.reload('lay-yxlx-create-manage'); //数据刷新
                                    layer.close(index); //关闭弹层
                                } else {
                                    layer.msg('数据通信异常~', {icon: 0});
                                }
                            }
                        });
                    })
                } else if (obj.event === '0') {
                    parent.layui.index.openTabsPage(basePath + '/collectProject/toDealOrDetail?id=' + data.id + '&proCode=' + data.proCode, '项目信息收集 > 详情');
                } else if (obj.event === '1') {
                    if (data.prepareProId) {
                        parent.layui.index.openTabsPage(basePath + '/preProject/toDealOrDetail?id=' + data.prepareProId + '&proCode=' + data.proCode, '预立项 > 详情');
                    }
                } else if (obj.event === '2') {
                    if (data.projectId) {
                        parent.layui.index.openTabsPage(basePath + '/setupPro/toDealOrDetail?id=' + data.projectId + '&proCode=' + data.proCode, '立项 > 详情');
                    }
                } else if (obj.event === '3') {
                    if (data.marketingId) {
                        parent.layui.index.openTabsPage(basePath + '/proSell/toDealOrDetail?proCode=' + data.proCode + '&id=' + data.marketingId, '营销策划 > 详情');

                    }
                }
            });
        }

        //项目信息收集
        /******************************************** 项目信息收集 *********************************************************/
        function loadXmxxsj() {
            //日期
            laydate.render({
                elem: '#xmxxsj-laydate-dates'
                , range: '~'
            });
            // 表单
            table.render({
                elem: '#lay-xmxxsj-create-manage'
                , url: basePath + '/collectProject/queryDataByCondition' //请求数据接口
                , cols: [[
                    {type: 'checkbox', fixed: 'left'}
                    , {field: 'proCode', title: '项目编码', width: 145}
                    , {field: 'proName', title: '项目名称'}
                    , {field: 'orgAreaName', title: '区域公司', align: 'center'}
                    , {
                        field: 'proTypes', title: '项目类型', width: 90, templet: function (d) {
                            if (d.proTypes == '1') {
                                return 'PPP项目';
                            } else {
                                return '';
                            }
                        }
                    }
                    , {
                        field: 'addTime', title: '创建时间', width: 160, templet: function (d) {
                            return layui.util.toDateString(d.addTime, "yyyy-MM-dd");
                        }
                    }
                    , {field: 'staffName', title: '营销经理', width: 100}
                    , {
                        field: 'sumAmount', title: '总投资额（万元）', width: 150, templet: function (d) {
                            return formatCurrency(d.sumAmount);
                        }
                    }
                    , {
                        field: 'isTrack', title: '单据状态', width: 155, templet: function (d) {
                            var status = '';
                            if (d.isTrack == '0') {
                                status = '继续跟踪'
                            } else if (d.isTrack == '1') {
                                status = '终止跟踪'
                            }
                            return status
                        }
                    }
                    , {
                        title: '操作', width: 140, align: 'center', fixed: 'right', templet: function (d) {
                            var optStr = "";
                            optStr += '<a class="layui-btn layui-btn-xs" lay-event="view"><i class="layui-icon layui-icon-form"></i>详情</a>';
                            return optStr;
                        }
                    }
                ]]
                , page: true
                , limit: 10
            });

            //监听新建
            form.on('submit(lay-xmxxsj-new)', function (data) {
                parent.layui.index.openTabsPage(basePath + '/collectProject/toDealOrDetail', '项目信息收集 > 详情');
            });

            //监听搜索
            form.on('submit(lay-xmxxsj-search)', function (data) {
                table.reload('lay-xmxxsj-create-manage', {
                    page: {curr: 1},
                    where: trimData(data)
                });
            });
            //重置清空
            form.on('submit(lay-xmxxsj-back-reset)', function (data) {
                reset_form('xmxxsj-query-form');
                //额外处理select
                $("#query-form-state").val('');
                form.render();
            });


            // 监听操作列
            table.on('tool(lay-xmxxsj-create-manage)', function (obj) {
                var data = obj.data;
                if (obj.event === 'view') {//查看详情
                    parent.layui.index.openTabsPage(basePath + '/collectProject/toDealOrDetail?id=' + data.id + '&proCode=' + data.proCode, '项目信息收集 > 详情');
                } else if (obj.event === 'copy') {//复制单据
                    parent.layui.index.openTabsPage(basePath + '/collectProject/toCopy?id=' + data.id, '项目信息收集 > 复制单据');
                } else if (obj.event === 'del') {
                    layer.confirm('确定要删除？', {icon: 3, title: '提示'}, function (index) {
                        $.ajax({
                            type: 'post',
                            url: basePath + '/flowProcess/logicDel',
                            data: {
                                "processId": data.processId
                            },//数据，这里使用的是Json格式进行传输
                            success: function (result) {
                                if (result) {
                                    table.reload('lay-xmxxsj-create-manage'); //数据刷新
                                    layer.close(index); //关闭弹层
                                } else {
                                    layer.msg('数据通信异常~', {icon: 0});
                                }
                            }
                        });
                    })
                }
            });
        }

        //预立项
        /*************************************************** 预立项 **********************************************************/
        function loadYlx() {
            //日期
            laydate.render({
                elem: '#ylx-laydate-dates'
                , range: '~'
            });

            // 表单
            table.render({
                elem: '#lay-ylx-create-manage'
                ,
                url: basePath + '/preProject/queryDataByCondition' //请求数据接口
                ,
                cols: [[
                    {type: 'checkbox', fixed: 'left'}
                    , {field: 'proCode', title: '项目编码', width: 145}
                    , {field: 'proName', title: '项目名称'}
                    , {
                        field: 'proTypes', title: '项目类型', width: 90, templet: function (d) {
                            if (d.proTypes == '1') {
                                return 'PPP项目';
                            } else if (d.proTypes == '2') {
                                return 'EPC项目';
                            } else {
                                return '';
                            }

                        }
                    }
                    , {
                        field: 'addTime', title: '创建时间', width: 160, templet: function (d) {
                            return layui.util.toDateString(d.addTime, "yyyy-MM-dd");
                        }
                    }
                    , {field: 'staffName', title: '营销经理', width: 100}
                    , {field: 'cityName', title: '项目城市', width: 155}
                    , {
                        field: 'isMeet', title: '是否满足底线', width: 150, templet: function (d) {
                            if (d.isMeet == '0') {
                                return '满足';
                            } else if (d.isMeet == '1') {
                                return '不满足';
                            } else {
                                return ''
                            }
                        }
                    }
                    , {
                        title: '操作', width: 140, align: 'center', fixed: 'right', templet: function (d) {
                            var optStr = "";
                            optStr += '<a class="layui-btn layui-btn-xs" lay-event="view"><i class="layui-icon layui-icon-form"></i>详情</a>';
                            return optStr;
                        }
                    }
                ]]
                ,
                page: true
                ,
                limit: 10
            });

            //监听搜索
            form.on('submit(lay-ylx-search)', function (data) {
                table.reload('lay-ylx-create-manage', {
                    page: {curr: 1},
                    where: trimData(data)
                });
            });
            //重置清空
            form.on('submit(lay-ylx-back-reset)', function (data) {
                reset_form('ylx-query-form');
                //额外处理select
                $("#query-form-state").val('');
                form.render();
            });

            // 监听操作列
            table.on('tool(lay-ylx-create-manage)', function (obj) {
                var data = obj.data;
                if (obj.event === 'view') {//查看详情
                    parent.layui.index.openTabsPage(basePath + '/preProject/toDealOrDetail?id=' + data.id + '&proCode=' + data.proCode, '预立项 > 详情');
                } else if (obj.event === 'copy') {//复制单据
                    parent.layui.index.openTabsPage(basePath + '/collectProject/toCopy?id=' + data.id, '项目信息收集 > 复制单据');
                } else if (obj.event === 'del') {
                    layer.confirm('确定要删除？', {icon: 3, title: '提示'}, function (index) {
                        $.ajax({
                            type: 'post',
                            url: basePath + '/flowProcess/logicDel',
                            data: {
                                "processId": data.processId
                            },//数据，这里使用的是Json格式进行传输
                            success: function (result) {
                                if (result) {
                                    table.reload('lay-ylx-create-manage'); //数据刷新
                                    layer.close(index); //关闭弹层
                                } else {
                                    layer.msg('数据通信异常~', {icon: 0});
                                }
                            }
                        });
                    })
                }
            });
        }

        //立项
        /*************************************************** 立项 **********************************************************/
        function loadLx() {
            //日期
            laydate.render({
                elem: '#lx-laydate-dates'
                , range: '~'
            });

            // 表单
            table.render({
                elem: '#lay-lx-create-manage'
                , url: basePath + '/setupPro/queryDataByCondition' //请求数据接口
                , cols: [[
                    {type: 'checkbox', fixed: 'left'}
                    , {field: 'proCode', title: '项目编码', width: 145}
                    , {field: 'proName', title: '项目名称'}
                    , {field: 'orgAreaName', title: '区域公司', align: 'center'}
                    , {
                        field: 'proTypes', title: '项目类型', width: 90, templet: function (d) {
                            if (d.proTypes == '1') return 'PPP项目';
                            if (d.proTypes == '2') return 'EPC项目';
                        }
                    }
                    , {
                        field: 'addTime', title: '创建时间', width: 160, templet: function (d) {
                            return layui.util.toDateString(d.addTime, "yyyy-MM-dd");
                        }
                    }
                    , {field: 'staffName', title: '营销经理', width: 100}
                    , {
                        field: 'sumAmount', title: '总投资额（万元）', width: 150, templet: function (d) {
                            return formatCurrency(d.sumAmount);
                        }
                    }

                    , {
                        field: 'processStatus', title: '单据状态', width: 150, templet: function (d) {
                            var status = '';
                            if (d.processStatus == '1') {
                                status = '审批中'
                            } else if (d.processStatus == '9') {
                                status = '审批完成'
                            } else if (d.processStatus == '10') {
                                status = '审批终止'
                            }
                            return status
                        }
                    }

                    , {
                        title: '操作', width: 140, align: 'center', fixed: 'right', templet: function (d) {
                            var optStr = "";
                            optStr += '<a class="layui-btn layui-btn-xs" lay-event="view"><i class="layui-icon layui-icon-form"></i>详情</a>';
                            return optStr;
                        }
                    }
                ]]
                , page: true
                , limit: 10
            });

            //监听搜索
            form.on('submit(lay-lx-search)', function (data) {
                table.reload('lay-lx-create-manage', {
                    page: {curr: 1},
                    where: trimData(data)
                });
            });
            //重置清空
            form.on('submit(lay-lx-back-reset)', function (data) {
                reset_form('lx-query-form');
                //额外处理select
                $("#query-form-state").val('');
                form.render();
            });

            // 监听操作列
            table.on('tool(lay-lx-create-manage)', function (obj) {
                var data = obj.data;
                if (obj.event === 'view') {//查看详情
                    parent.layui.index.openTabsPage(basePath + '/setupPro/toDealOrDetail?id=' + data.id + '&proCode=' + data.proCode, '立项 > 详情');
                }
            });
        }

        //营销策划
        /*************************************************** 营销策划 **********************************************************/
        function loadYxch() {
            //日期
            laydate.render({
                elem: '#yxch-laydate-dates'
                , range: '~'
            });

            // 表单
            table.render({
                elem: '#lay-yxch-create-manage'
                , url: basePath + '/proSell/queryDataByCondition' //请求数据接口
                , cols: [[
                    {type: 'checkbox', fixed: 'left'}
                    , {field: 'proCode', title: '项目编码', width: 145}
                    , {field: 'proName', title: '项目名称'}
                    , {field: 'compName', title: '区域公司', align: 'center'}
                    , {
                        field: 'proTypes', title: '项目类型', width: 90, templet: function (d) {
                            if (d.proTypes == '1') return 'PPP项目';
                            else return '';
                        }
                    }
                    , {
                        field: 'addTime', title: '创建时间', width: 160, templet: function (d) {
                            return layui.util.toDateString(d.addTime, "yyyy-MM-dd");
                        }
                    }
                    , {field: 'staffName', title: '营销经理', width: 100}
                    , {field: 'costMoney', title: '营销总费用', width: 150,}
                    , {
                        field: 'processStatus', title: '单据状态', width: 150, templet: function (d) {
                            var status = '';
                            if (d.processStatus == '1') {
                                status = '审批中'
                            } else if (d.processStatus == '9') {
                                status = '审批完成'
                            } else if (d.processStatus == '10') {
                                status = '审批终止'
                            }
                            return status
                        }
                    }
                    , {
                        title: '操作', width: 140, align: 'center', fixed: 'right', templet: function (d) {
                            var optStr = "";
                            optStr += '<a class="layui-btn layui-btn-xs" lay-event="view"><i class="layui-icon layui-icon-form"></i>详情</a>';
                            return optStr;
                        }
                    }
                ]]
                , page: true
                , limit: 10
            });

            //监听搜索
            form.on('submit(lay-yxch-search)', function (data) {
                table.reload('lay-yxch-create-manage', {
                    page: {curr: 1},
                    where: trimData(data)
                });
            });
            //重置清空
            form.on('submit(lay-yxch-back-reset)', function (data) {
                reset_form('yxch-query-form');
                //额外处理select
                $("#query-form-state").val('');
                form.render();
            });

            // 监听操作列  营销策划详情
            table.on('tool(lay-yxch-create-manage)', function (obj) {
                var data = obj.data;
                if (obj.event === 'view') {//查看详情
                    parent.layui.index.openTabsPage(basePath + '/proSell/toDealOrDetail?proCode=' + data.proCode + '&id=' + data.id, '营销策划 > 详情');
                }
            });
        }

        //风险总览
        /*************************************************** 风险总览 **********************************************************/
        function loadFxzl() {
            // 表单
            table.render({
                elem: '#lay-fxzl-create-manage'
                , url: basePath + '/projectRisk/queryDataByCondition' //请求数据接口
                , cols: [[
                    {type: 'checkbox', fixed: 'left'}
                    , {field: 'proCode', title: '项目编码', width: 145}
                    , {field: 'compName', title: '区域公司', width: 90}
                    , {field: 'proName', title: '项目名称'}
                    , {
                        field: 'riskSum', title: '风险总数', width: 160, templet: function (d) {
                            var optStr = "";

                            optStr += '<div style="cursor: pointer;"  lay-event="toTotalSum">' + d.riskSum + '</div>';
                            return optStr;
                        }
                    }
                    , {
                        field: 'normalSum', title: '未销项数', width: 100, templet: function (d) {
                            var optStr = "";

                            optStr += '<div style="cursor: pointer;"  lay-event="toNormalSum">' + d.normalSum + '</div>';
                            return optStr;
                        }
                    }
                    , {
                        field: 'highSum', title: '高风险未销项', width: 155, templet: function (d) {
                            var optStr = "";

                            optStr += '<div style="cursor: pointer;"  lay-event="toHighRisk">' + d.highSum + '</div>';
                            return optStr;
                        }
                    }
                    , {
                        field: 'medSum', title: '中风险未销项', width: 150, templet: function (d) {
                            var optStr = "";

                            optStr += '<div style="cursor: pointer;"  lay-event="toMidRisk">' + d.medSum + '</div>';
                            return optStr;
                        }
                    }
                    , {
                        field: 'lowSum', title: '低风险未销项', width: 150, templet: function (d) {
                            var optStr = "";

                            optStr += '<div style="cursor: pointer;"  lay-event="toLowRisk">' + d.lowSum + '</div>';
                            return optStr;
                        }
                    }
                    , {
                        title: '操作', width: 140, align: 'center', fixed: 'right', templet: function (d) {
                            var optStr = "";
                            optStr += '<a class="layui-btn layui-btn-xs" lay-event="view"><i class="layui-icon layui-icon-form"></i>详情</a>';
                            return optStr;
                        }
                    }
                ]]
                , page: true
                , limit: 10
            });

            //监听搜索
            form.on('submit(lay-fxzl-search)', function (data) {
                table.reload('lay-fxzl-create-manage', {
                    page: {curr: 1},
                    where: trimData(data)
                });
            });
            //重置清空
            form.on('submit(lay-fxzl-back-reset)', function (data) {
                reset_form('fxzl-query-form');
                //额外处理select
                $("#query-form-state").val('');
                form.render();
            });

            // 监听操作列
            table.on('tool(lay-fxzl-create-manage)', function (obj) {
                var data = obj.data;
                console.log(data)
                if (obj.event === 'view') {//查看详情
                    parent.layui.index.openTabsPage(basePath + '/projectRisk/selectByTotalNum?proCode=' + data.proCode, '风险总览 > 详情');
                } else if (obj.event === 'copy') {//复制单据
                    parent.layui.index.openTabsPage(basePath + '/collectProject/toCopy?id=' + data.id, '项目信息收集 > 复制单据');
                } else if (obj.event === 'del') {
                    layer.confirm('确定要删除？', {icon: 3, title: '提示'}, function (index) {
                        $.ajax({
                            type: 'post',
                            url: basePath + '/flowProcess/logicDel',
                            data: {
                                "processId": data.processId
                            },//数据，这里使用的是Json格式进行传输
                            success: function (result) {
                                if (result) {
                                    table.reload('lay-fxzl-create-manage'); //数据刷新
                                    layer.close(index); //关闭弹层
                                } else {
                                    layer.msg('数据通信异常~', {icon: 0});
                                }
                            }
                        });
                    })
                } else if (obj.event === 'toTotalSum') {
                    console.log(data);
                    parent.layui.index.openTabsPage(basePath + '/projectRisk/selectByTotalNum?proCode=' + data.proCode, ' 风险总数');
                } else if (obj.event === 'toNormalSum') {
                    console.log(data);

                    parent.layui.index.openTabsPage(basePath + '/projectRisk/selectByNormalNum?proCode=' + data.proCode, ' 未销项');
                } else if (obj.event === 'toHighRisk') {
                    console.log(data);
                    parent.layui.index.openTabsPage(basePath + '/projectRisk/selectByHighRisk?proCode=' + data.proCode, ' 高风险未销项');
                } else if (obj.event === 'toMidRisk') {
                    console.log(data);
                    parent.layui.index.openTabsPage(basePath + '/projectRisk/selectByMidRisk?proCode=' + data.proCode, ' 中风险未销项');
                } else if (obj.event === 'toLowRisk') {
                    console.log(data);

                    parent.layui.index.openTabsPage(basePath + '/projectRisk/selectByLowRisk?proCode=' + data.proCode, ' 低风险未销项');
                }
            });
        }

        // data-type事件
        $('.layui-btn.layuiadmin-btn-admin').on('click', function () {
            var type = $(this).data('type');
            active[type] ? active[type].call(this) : '';
        });
    });
</script>
</body>
</html>

